package com.tangding.hprose.filters;

import java.nio.ByteBuffer;

import hprose.common.HproseContext;
import hprose.common.HproseFilter;
import hprose.util.StrUtil;

/**
 * @description 
 *
 * @author Ranger
 * @version 2017年11月21日_下午2:34:16
 *
 */
public class LogFilter implements HproseFilter {

	@Override
	public ByteBuffer inputFilter(ByteBuffer buffer, HproseContext context) {
		System.out.println(StrUtil.toString(buffer));
		if (buffer.position() != 0) {
            buffer.flip();
        }
        byte[] bytes = new byte[buffer.limit()];
        buffer.get(bytes);
        
        buffer.flip();
		return buffer;
	}

	@Override
	public ByteBuffer outputFilter(ByteBuffer data, HproseContext context) {
		System.out.println(StrUtil.toString(data));
		return data;
	}
}
